package com.ruoyi.web.controller.api.suggest;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.domain.PAskType;
import com.ruoyi.system.domain.vo.PAskTypeVo;
import com.ruoyi.system.service.IPAskTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * @Description: 咨询类别api
 * @Author: wk
 * @Date: 2022/7/19 8:31
 * @Version: 1.0
 */
@Validated
@Api(value = "咨询类别控制器", tags = {"前端-咨询类别管理"})
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/askType")
public class AskTypeApiController extends BaseController {

    private final IPAskTypeService iPAskTypeService;

    /**
     * 查询咨询类别列表 下拉
     */
    @ApiOperation("查询咨询类别列表")
    @GetMapping("/list")
    public R<List<PAskType>> getSelectList() {
        return R.ok(iPAskTypeService.getSelectList());
    }

    @ApiOperation("查询咨询类别")
    @GetMapping("/detail")
    public R<PAskType> getSelectDetail(@RequestParam("typeId") Long typeId) {
        return R.ok(iPAskTypeService.getSelectDetail(typeId));
    }

    /**
     * 获取咨询类别详细信息
     */
    @ApiOperation("获取咨询类别详细信息")
    @GetMapping("/{id}")
    public R<PAskTypeVo> getInfo(@ApiParam("主键")
                                     @NotNull(message = "主键不能为空")
                                     @PathVariable("id") Long id) {
        return R.ok(iPAskTypeService.queryById(id));
    }
}
